/**
 * Created by 123 on 2017/12/26.
 * 站长选择任务与监督员
 */
import React from 'react';
import {
  View,
  Text
} from 'react-native';
import {connect} from 'dva-no-router';
import {bindActionCreators} from 'redux'
import UI from '../../components/master/TaskForm';

class App extends React.Component {

  componentDidMount() {
    const {query}=this.props;
    query();
  }
    componentWillUnmount(){
        const {getClean}=this.props;
        getClean();
    }
  render() {
    return (
      <UI {...this.props}/>
    )
  }
}

const mProps = ({masterTaskForm}) => ({...masterTaskForm})

const actions = {
    thisSelect:() =>({type:'masterTaskForm/thisSelect'}),
    thisBeSelected:(val) =>({type:'masterTaskForm/thisBeSelected',payload:val}),
  query: () => ({type: 'masterTaskForm/query'}),
  //任务结束时间
  setClosingDate:(val) => ({type:'masterTaskForm/setClosingDate',payload:val}),

  setCurrentProject: (id) => ({type: 'masterTaskForm/setCurrentProject', payload: id}),

  setCurrentNameList: (id) => ({type: 'masterTaskForm/setCurrentNameList', payload: id}),

  // setTaskNum: (text) => ({type: 'masterTaskForm/setTaskNum', payload: text}),

  setTaskText:(text) => ({type:'masterTaskForm/setTaksText',payload:text}),//备注内容

  setTaskName: (text) => ({type: 'masterTaskForm/setTaskName', payload: text}),

  commit: () => ({type: 'masterTaskForm/commit'}),

  changeText: (val) => ({type: 'masterTaskForm/changeText',payload:val}),

  search: (val) => ({type: 'masterTaskForm/search',payload:val}),

    getClean:() =>({type:'masterTaskForm/getClean'})
};

const mActions = dispatch => ({
  ...bindActionCreators({...actions}, dispatch)
});


export default connect(mProps, mActions)(App)